﻿Imports kplusEntity.KPLUS.Entity
Imports kplusLogic.KPLUS.Logic
Imports kplusCommon.KPLUS.Common

Partial Public Class frmCategoriaPonderadorMnt
    Inherits System.Web.UI.Page
    Private ruta As String
    Dim strUserId As String = Request.Cookies("UserId").Value
    Dim strConexion As String
    Dim lstCategoriPonderado As List(Of ETipoExposicion)

    Private Sub EditarCategoria(ByVal sender As Object, ByVal e As EventArgs)

    End Sub

    Private Sub ActualizarCategoria(ByVal sender As Object, ByVal e As EventArgs)

    End Sub

    Private Sub CancelarCategoria(ByVal sender As Object, ByVal e As EventArgs)

    End Sub

    Private Sub EliminarCategoria(ByVal sender As Object, ByVal e As EventArgs)

    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            If Not Page.IsPostBack Then
                'orutina.LimpiarCache()
                'hdfSession.Value = Guid.NewGuid.ToString
                'hdfuser.Value = HttpUtility.UrlDecode(Request.QueryString("user"))


                'btnCerrar.Attributes.Add("onclick", "window.close();")
            End If
        Catch ex As Exception
            ScriptManager.RegisterStartupScript(Me, Page.GetType, "Aviso", "alert('Ocurrió un error al cargar');", True)
        End Try
        lstCategoriPonderado = New List(Of ETipoExposicion)
        ConfigurarScript()
    End Sub

    Private Sub ConfigurarScript()
        Dim strPeriodoMes As String
        Dim strVersion As String
        strPeriodoMes = lblPeriodo.Text
        strVersion = lblVersion.Text
        ruta = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath
        imbHistoricoCat.Attributes.Add("onclick", "VerHistoricoConsultaDeVersiones('" + ruta + "','" + strPeriodoMes + "','" + strVersion + "');")

    End Sub


    Protected Sub imbGuardar_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imbGuardarCat.Click
        Dim objECategoriaPonderador As New ETipoExposicion
        Dim objELogMantenimiento As New ELogMantenimiento
        Dim objLCategoriaPonderador As New LTipoExposicion
        Dim strUserId As String = Request.Cookies("UserId").Value
        strConexion = ConfigurationManager.ConnectionStrings("ConnectionStringOracle").ConnectionString
        '      .CodUsrRegistro = strUserId

        With objECategoriaPonderador
            .CodTipoExposicion = lblCategoria.Text
            '  .CodTipoExposicion2A1 = lblCodExcel.Text
            .FecActualizacionTabla = Date.Now
            .PctPonderador = lblPonderadores.Text

        End With

        With objELogMantenimiento
            .CodUsrRegistro = strUserId
            .FecActualizacionTabla = Date.Now
            .FecRegistro = Date.Now
            .FlgActivo = True
            .NumVersion = 1
            .PeriodoMes = lblPeriodo.Text
            .TipoOperacion = Constante.TipoOperacion.R
            .CodMantenimiento = ""
            .DesMantenimiento = ""
            .DESCOMENTARIO = ""
            .NumAnhio = Date.Now.Year
        End With

        '   objLCategoriaPonderador.fInsertarLimiteGlobal(strConexion, objECategoriaPonderador, objELogMantenimiento)

    End Sub

    Protected Sub AgregarOneClick(ByVal sender As Object, ByVal e As EventArgs) Handles btnAgregar.Click
        Dim strCodigo As String
        Dim strCategoria As String
        Dim strCodExcel As String
        Dim strPonderador As String
        Dim entyETExp As ETipoExposicion = New ETipoExposicion
        strCodigo = txtCodigo.Text
        strCategoria = txtCategoria.Text
        strCodExcel = txtCodExcel.Text
        strPonderador = txtPonderadores.Text
        lstCategoriPonderado.Add(entyETExp)

        gvwAgregarCategoíaPonderador.Visible = True
        gvwAgregarCategoíaPonderador.DataSource = lstCategoriPonderado
        gvwAgregarCategoíaPonderador.DataBind()

    End Sub
End Class